package com.plian.system.enumeratea;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @description:
 * @author: gangan
 * @create: 2022-01-13 09:51
 */

@Getter
@AllArgsConstructor
public enum FieldType {

    TINYINT("tinyint", "Integer"),
    INT("int", "Integer"),
    BIGINT("bigint", "Long"),
    VARCHAR("varchar", "String"),
    TEXT("text", "String"),
    decimal("decimal", "BigDecimal"),
    DATE("date", "Date"),
    DATETIME("datetime", "DateTime");

    private String dataType;

    private String fieldType;

    public static String dataTypeToFieldType(String dataType){
        for (FieldType fieldType : FieldType.values()){
            if (fieldType.getDataType().equals(dataType)){
                return fieldType.getFieldType();
            }
        }
        return null;
    }
}
